<?php 
define('IN_WONDERSHARE', true);
if( $_GET['code'] != md5('uninstall') ) exit('error code!');
include_once('file_util.class.php');//载入文件操作类

//收集页面上提交的信息放入文件中
function insertFileInformation()
{
	if(!empty($_GET['web_name']))
	{
		
		$filePath = '/var/www/website/cms.wondershare.com/httpdocs/image2/uninstall/'.$_GET['web_name'].'_'.getWebDir($_GET['document_href']).'.txt';
		if(!isset($file))
		{
			$file = new  FileUtil();
		}
		$file->createFile($filePath);//如果文件不存在则不创建。
		$strInsert = $_GET['first_name'].'		'.$_GET['last_name'].'		'.$_GET['e_mail'].'		'.date('Y-m-d H:i:s', time() + 13*3600 ).'         '.$_GET['document_href']."\n";
		
		if(file_put_contents($filePath, $strInsert, FILE_APPEND))
		{
			echo 1;
		}else
		{
			echo 0;
		}
		
	}else
	{
		echo 0;
	}
}

//根据网站url  得到网站目录
function getWebDir($url)
{
	$webArray = parse_url($url);
	$dirPathArray = explode('/',$webArray['path']);
	$webDir = '';
	$nums = count($dirPathArray);
	foreach ($dirPathArray AS $keys => $values)
	{
		if(($keys + 1)  == $nums )
			break;
		$webDir .= empty($webDir) ? $values : '_'.$values;
	}
	return  $webDir;
}

$fun = $_GET['fun'];
$fun();
?>